{include file="layout/header" title="基本设置" /}
<div class="view-body">
    {include file="layout/menu" /}
    <div class="view-product">
        <div class="company_identify">
            <div class="manage-head">
                <h6 class="padding-left manage-head-con">
                    基本设置
                </h6>
            </div>
            <form action="{:url('admin/Config/save',['key'=>'site'])}" class="layui-form" method="post" name="siteForm">
                <div class="basic-info-detail clearfix">
                    <div class="layui-form-item margin-left-300 margin-top-25">
                        <label class="layui-form-label width-small">
                            网站开关
                        </label>
                        <div class="layui-input-block">
                            <input checked="" name="siteStatus" title="运行中" type="radio" value="1">
                                <input name="siteStatus" title="维护中" type="radio" value="0">
                                </input>
                            </input>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            调试模式
                        </label>
                        <div class="layui-input-block">
                            <input lay-skin="switch" name="deBug" type="checkbox">
                            </input>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            网站名称
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <input class="layui-input" lay-verify="required" name="siteName" type="text">
                            </input>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            网站域名
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <input class="layui-input" lay-verify="required" name="siteUrl" type="text">
                            </input>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            http:// 开头，结束不需要带 /
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            网站LOGO
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <input class="layui-upload-file" lay-title="上传logo" lay-type="images" name="image" type="file">
                            </input>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300" id="siteLogo" style="display:none;">
                        <label class="layui-form-label width-small">
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <input name="siteLogo" type="hidden" value="">
                                <img height="115" id="logoImg" src="" style="border: 1px solid #eee;" width="115">
                                </img>
                            </input>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            SEO关键字
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <input class="layui-input" name="seoKey" type="text">
                            </input>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            利于搜索引擎收录，多个关键词用，号分割
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            备案号
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <input class="layui-input" name="recordNum" type="text">
                            </input>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            工信部备案信息
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            统计代码
                        </label>
                        <div class="layui-input-inline" style="width:350px;">
                            <textarea class="layui-textarea" name="siteCount">
                            </textarea>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            第3方网站统计，如CNZZ 等
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            注册协议
                        </label>
                        <div class="layui-input-inline" style="width:700px;">
                            <textarea id="agreement" name="agreement" style="display: none;"></textarea>
                            </textarea>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <label class="layui-form-label width-small">
                            代理协议
                        </label>
                        <div class="layui-input-inline" style="width:700px;">
                            <textarea id="agencyAgreement" name="agencyAgreement" style="display: none;"></textarea>
                            </textarea>
                        </div>
                    </div>
                    <div class="layui-form-item margin-left-300">
                        <div class="layui-input-block margin-left-100">
                            <button class="layui-btn layui-btn-normal" lay-filter="smsYes" lay-submit="">
                                确定
                            </button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    var formObj = new Form('siteForm');
    	formObj.init({$site});

			$('#logoImg').attr('src', '/uploads/images/' + $('input[name=siteLogo]').val());
			$('#siteLogo').show();

			layui.use(['form','upload','layer','layedit'], function(){

				var layer = layui.layer;
				var $ = layui.jquery;
                var layedit = layui.layedit;
                layedit.set({
                    uploadImage: {
                        url: "{:url('admin/upload/layedit')}", //编辑器图片上传接口url
                        type: 'post'
                    }
                });
                layedit.build('agreement'); //建立编辑器
                layedit.build('agencyAgreement'); //建立编辑器

				layui.upload({
				  url: "{:url('admin/upload/image','width=120&height=120')}",
					method: 'post',
					success: function(res){
						if(res.status == 1){
							$('input[name=siteLogo]').val(res.src);
							$('#logoImg').attr('src','/uploads/images/' + res.src);
							$('#siteLogo').show();
							layer.msg(res.msg);
						}else {
							$('#siteLogo').hide();
							layer.msg('上传失败！');
						}
				  }
				});

			});
</script>
{include file="layout/footer" /}
